from dotenv import load_dotenv
import duckdb
import os

load_dotenv()
S3_ACCESS_KEY = os.getenv("S3_ACCESS_KEY")
S3_ENDPOINT_URL = os.getenv("S3_ENDPOINT_URL")
S3_SECRET_KEY = os.getenv("S3_SECRET_KEY")
BUCKETNAME = 'gitverse'

duckdb.query("install 'httpfs';")
duckdb.query("load 'httpfs';")
duckdb.sql(
    f"""CREATE SECRET (
    TYPE S3,
    KEY_ID '{S3_ACCESS_KEY}',
    SECRET '{S3_SECRET_KEY}',
    REGION 'us-east-1',
    URL_STYLE 'path',
    ENDPOINT '{S3_ENDPOINT_URL}',
    SCOPE 's3://{BUCKETNAME}'
);"""
)
